{extend name="template/base" /}


{block name="content"}
<div class="pd-10 mt-30">
	<div class="cl pd-5 bg-1 bk-gray"> 
		{if condition="showAuth('admin/AuthRule/add')"}
			<span class="l">
				<a class="btn btn-primary radius add-btn" data-title="添加顶级规则" data-url="{:url('add',['pid'=>0])}" href="javascript:;"><i class="Hui-iconfont">&#xe600;</i> 添加顶级规则</a>
			</span> 
		{/if}
	</div>
	<table class="table table-border table-bordered table-hover table-bg table-sort">
		<thead>
			<tr>
				<th scope="col" colspan="6" class="text-c"><h3>规则列表</h3></th>
			</tr>
			<tr class="text-c">
				<th width="20%"><h4>规则描述</h4></th>
				<th width="30%"><h4>规则名</h4></th>
				<th width="25%"><h4>附加规则</h4></th>
				<th width="5%"><h4>状态</h4></th>
				<th width="20%"><h4>操作</h4></th>
			</tr>
		</thead>
		{volist name="parent" id="v"}
			<tbody>
				<td class="danger"><strong>{$v.title}</strong></td>
				<td class="danger"><strong>{$v.name}</strong></td>
				<td class="danger"><strong>{$v.condition? $v.condition : '<mark>没有设置附加规则</mark>' }</strong></td>
				<td class="danger"><strong>{$v.status? '<span class="label label-success radius">启用</span>' : '<span class="label label-danger radius">禁用</span>'}</strong></td>
				<td >
					{if condition="showAuth('admin/AuthRule/add')"}
						<input class="btn btn-primary  radius  size-S add-btn" type="button" data-url="{:url('add',['pid'=>$v.id])}" data-title="添加子规则" value="添加子规则">
					{/if}
					{if condition="showAuth('admin/AuthRule/edit')"}
						<input class="btn btn-default  radius  size-S edit-btn" data-url="{:url('edit',['id'=>$v.id])}" type="button" data-title="编辑规则:{$v.title}" value="编辑">
					{/if}
					{if condition="showAuth('admin/AuthRule/delete')"}
						<input class="btn btn-danger radius  size-S delete-btn" data-url="{:url('delete')}" data-id="{$v.id}" type="button" value="删除">
					{/if}
				</td>
			</tbody>
				{volist name="v.child" id="v1"}
					<tbody>
						<td>|———— {$v1.title}</td>
						<td>{$v1.name}</td>
						<td>{$v1.condition? $v1.condition : '<mark>没有设置附加规则</mark>' }</td>
						<td>{$v1.status? '<span class="label label-success radius">启用</span>' : '<span class="label label-danger radius">禁用</span>'}</td>
						<td>
							{if condition="showAuth('admin/AuthRule/edit')"}
								<input class="btn btn-default  radius  size-S edit-btn" data-url="{:url('edit',['id'=>$v1.id])}" type="button" data-title="编辑规则:{$v1.title}" value="编辑">
							{/if}
							{if condition="showAuth('admin/AuthRule/delete')"}
								<input class="btn btn-danger radius  size-S delete-btn" data-url="{:url('delete')}" data-id="{$v1.id}" type="button" value="删除">
							{/if}
						</td>
					</tbody>
				{/volist}
				
		{/volist}
	</table>
</div>
{/block}



{block name="script"}
	<script type="text/javascript" src="__AJS__/auth_rule/index.js"></script>
{/block}